all:diss.bbl latexbuild viewpdf

install_all:pkginstall texlive2008 msfonts_down msfonts_install

diss.bbl:reference/chap1.bib reference/chap2.bib
	-xelatex diss      
	-bibtex diss 
	-xelatex diss


recover:
	-cp ./diss.tex ./lang/en/diss.tex
	-cp ./body/abstract.tex ./lang/en/body/abstract.tex    

	-cp ./body/chapter01.tex ./lang/en/body/chapter01.tex
	-cp ./body/chapter02.tex ./lang/en/body/chapter02.tex

	-cp ./body/pub.tex ./lang/en/body/pub.tex
	-cp ./body/thanks.tex ./lang/en/body/thanks.tex
	-cp ./body/app1.tex ./lang/en/body/app1.tex

translate:
	chmod 755 ./translation_tool/xgltrans.pl
	-./translation_tool/xgltrans.pl ./diss.tex >./lang/en/diss.tex
	-./translation_tool/xgltrans.pl ./body/abstract.tex >./lang/en/body/abstract.tex    

	-./translation_tool/xgltrans.pl ./body/chapter01.tex >./lang/en/body/chapter01.tex
	-./translation_tool/xgltrans.pl ./body/chapter02.tex >./lang/en/body/chapter02.tex

	-./translation_tool/xgltrans.pl ./body/pub.tex >./lang/en/body/pub.tex
	-./translation_tool/xgltrans.pl ./body/thanks.tex >./lang/en/body/thanks.tex
	-./translation_tool/xgltrans.pl ./body/app1.tex >./lang/en/body/app1.tex

latexbuild:
	-xelatex diss

viewpdf:
	-evince diss.pdf &

enversion:
	make -C ./lang/en

texlive2008:
	echo please select "create link" 
	echo 请选择创建连接，在你安装的时候 
	sudo apt-get install perl-tk
	sudo /cdrom/install-tl -gui

pkginstall:
	tar jxvf fontsinstall/texlive2008-texmf-var_nodoc.tar.bz2 -C ~/
	sudo apt-get install scim-pinyin 
	sudo apt-get install ttf-wqy-zenhei

msfonts_down:
	-sudo mkdir /usr/share/fonts/msfonts
	wget http://bilingthesis.googlecode.com/files/simsun.tar.lzma
	wget http://bilingthesis.googlecode.com/files/simhei.tar.lzma
	wget http://bilingthesis.googlecode.com/files/simkai.tar.lzma
	wget http://bilingthesis.googlecode.com/files/simfang.tar.lzma
	wget http://bilingthesis.googlecode.com/files/times.tar.lzma

msfonts_install:
	sudo tar --lzma -xvf ./simsun.tar.lzma -C /usr/share/fonts/msfonts
	sudo tar --lzma -xvf ./simhei.tar.lzma -C /usr/share/fonts/msfonts
	sudo tar --lzma -xvf ./simkai.tar.lzma -C /usr/share/fonts/msfonts
	sudo tar --lzma -xvf ./simfang.tar.lzma -C /usr/share/fonts/msfonts
	sudo tar --lzma -xvf ./times.tar.lzma -C /usr/share/fonts/msfonts
	sudo chmod 754 /usr/share/fonts/msfonts/*
	sudo mkfontdir
	sudo mkfontscale
	sudo fc-cache -fv

clean:
	-rm -f *.tar.lzma *.tar.lzma.* body/*.*~ *.*~ *~ *.blg *.bbl reference/*.log fonts.* reference/*.aux *.log *.aux *.pdf *.dvi *.out *.lot *.lof *.toc body/*.aux *.tmp >/dev/null 2>&1
	make -C ./lang/en clean
	make -C ./translation_tool clean

